<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        [v-cloak]{
            display: none;
        }
    </style>
</head>

<body>
    <div id="app">
        <input type="button" value="修改高度" @click="changeHeight">
        <!-- style使用对象 -->
        <p :style="s">我是个p</p>
        <p style="width:200px;background-color:skyblue" :style='{"height":h+"px"}'>我是个p</p>   

        <!-- style使用数组 -->
        <p :style="[arr1,arr2]">我是个p</p>

        

    </div>
    <script src="./js/vue.js"></script>

    <script>
        let vm = new Vue({
            el: "#app",
            data: {
               s:{
                    "width":"200px",
                    "height":"20px",
                    "backgroundColor":"skyblue"
                },
                h:20,
                arr1:{
                    width:"100px",
                },
                arr2:{
                    height:"50px",
                    backgroundColor:"red"
                }
            },
            methods:{
                changeHeight(){
                    // this.s.height = parseInt(this.s.height)+20+"px";
                    this.h += 20;
                }
            }
        })

    </script>
</body>

</html>